import random
from pathlib import Path
import shutil

s = [''.join(random.choices(bytes(range(97,123)).decode(),k=4)) for j in range(50)]
p = Path('a/b/c/d/')
p1 = p.parent
p2 = p1.parent
p3 = p2.parent
p.mkdir(mode=0o777,parents=True,exist_ok=True)

for i in s:
    (random.choice([p1,p2,p3,p]) / i).touch()

def fn(x):
    return not (x.startswith('x') or x.startswith('y') or x.startswith('z') or len(x)==1)

def ignore(src, names):
    ig = filter(fn, names)
    return set(ig)

shutil.copytree(Path(__file__).parent/'a',Path(__file__).parent/'tmp',ignore=ignore)